﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NHibernateBusiness.Data;
using Model;
using System.Data;

namespace DataDeal
{
    public class GoodsItemsDAL
    {
        private INHibernateHelper _helper;

        public GoodsItemsDAL()
        {
            _helper = NHibernateFactory.Instance.GetDataHandler();
        }


        public IList<GoodsItems> GetAllGoodsItems()
        {           
           
            return _helper.GetQuery<GoodsItems>();
        }
        public void Save(GoodsItems entity)
        {
            _helper.Save(entity);
        }
        public void Update(GoodsItems entity)
        {
            _helper.Update(entity);
        }

        public void Delete(GoodsItems entity)
        {
            _helper.Delete<GoodsItems>(entity);
        }

        public void Delete(string Id)
        {
            _helper.Delete(string.Format("delete from GoodsItems where Id='{0}'", Id));
        }
    }
}
